************************************* Load Data *************************************

use "/Users/vih539/Dropbox/Publications/Ambiguous Messaging/replication-files/ambiguity-motivated-reasoning-covid.dta", clear

cd "/Users/vih539/Dropbox/Publications/Ambiguous Messaging/replication-files"

*********************************** Main Analysis ***********************************

* Statistics mentioned in the manuscript
describe 




* Table 1
eststo clear
eststo: quietly regress avoid_5 treatment_A
eststo: quietly regress activities_6 treatment_A
esttab using table-1.rtf, replace cells("b(fmt(a3) star) se ci p") label                               ///
title(Dependent variable: Inferences + Intentions)       ///
addnote(unstandardized ols coefficients with standard error in parentheses)


* Table 2
eststo clear
eststo: quietly regress avoid_5 c.treatment_A##c.retro_6 if age<40 
eststo: quietly regress avoid_5 c.treatment_A##c.retro_6 if age>=40 
esttab using table-2.rtf, replace cells("b(fmt(a3) star) se ci p") label                               ///
title(Dependent variable: Inferences)       ///
addnote(unstandardized ols coefficients with standard error in parentheses)


* Table 3
eststo clear
eststo: quietly regress activities_6 c.treatment_A##c.retro_6 if age<40 
eststo: quietly regress activities_6 c.treatment_A##c.retro_6 if age>=40 
esttab using table-3.rtf, replace cells("b(fmt(a3) star) se ci p") label                               ///
title(Dependent variable: Intentions)       ///
addnote(unstandardized ols coefficients with standard error in parentheses)


* Note: Figure 1 was created in Microsoft Word 

* Figure 2(top)
reg activities_6 c.treatment_A##c.retro_6 if age<40 
margins, at(retro_6 = (1(1)180))  over(treatment_A)  
marginsplot, title("") xtitle(Retrospective Activities) ytitle(Prospsective Activities) yline(0, lc(black) lw(med) lp(dash)) text(150 30 "Ages 18-39, N = 497") scheme(s1mono)

* Figure 2(bottom)
reg activities_6 c.treatment_A##c.retro_6 if age>=40 
margins, at(retro_6 = (1(1)180))  over(treatment_A)  
marginsplot, title("") xtitle(Retrospective Activities) ytitle(Prospsective Activities) yline(0, lc(black) lw(med) lp(dash)) text(150 25 "Ages 40+, N = 398") scheme(s1mono)


****************************** Supplementary Materials ******************************

* Tables S1 & S2: Summary Statistics
gen durationinminutes = durationinseconds/60
summarize durationinminutes if age<40, d 
summarize durationinminutes if age>=40, d 

summarize avoid_5 if age<40, d 
summarize avoid_5 if age>=40, d

summarize retro_6 if age<40, d 
summarize retro_6 if age>=40, d

summarize activities_6 if age<40, d 
summarize activities_6 if age>=40, d  

summarize age if age<40, d 
summarize age if age>=40, d 

tab gender if age<40
tab gender if age>=40

tab activities_6 if age<40

* Table S3
encode q78, gen(citizenship)

eststo clear
eststo: quietly regress treatment_A retro_6 age i.gender i.citizenship if age<40 
eststo: quietly regress treatment_A retro_6 age i.gender i.citizenship if age>=40
estout 
esttab using table-s3.rtf, replace b(a3) se(2) r2(3) star(* 0.05) label                               ///
title(Dependent variable: Treatment Assignment)       ///
nonumbers mtitles("18-39" "40+") ///
addnote(unstandardized ols coefficients with standard error in parentheses)

* Joint orthogonality balance tests
regress treatment_A retro_6 age i.gender i.citizenship if age<40 
test retro_6 = age = 1.gender = 2.gender = 3.gender = 1.citizenship = 2.citizenship = 3.citizenship = 0

regress treatment_A retro_6 age i.gender i.citizenship if age>=40 
test retro_6 = age = 1.gender = 2.gender = 3.gender = 1.citizenship = 2.citizenship = 3.citizenship = 0


* Table S4
eststo clear
eststo: quietly regress avoid_5 c.treatment_A##c.retro_6 
eststo: quietly regress activities_6 c.treatment_A##c.retro_6 
esttab using table-s4.rtf, replace b(a3) se(2) r2(3) star(* 0.05) label                               ///
title(Dependent variable: )       ///
nonumbers mtitles("Inferences" "Retrospective Behaviours") ///
addnote(unstandardized ols coefficients with standard error in parentheses)

* Note: Figures S1 and S2 created in SigmaPlot
